//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package net.xiaoyu233.mitemod.miteite.trans.world;

import net.minecraft.*;
import net.xiaoyu233.mitemod.miteite.item.Items;
import net.xiaoyu233.mitemod.miteite.network.SPacketOverlayMessage;
import net.xiaoyu233.mitemod.miteite.util.Constant;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(DedicatedServer.class)
public class DedicatedServerTrans {

    public DedicatedServerTrans() {
    }

    @Inject(method = "playerLoggedIn", at = @At("RETURN"))
    public void playerLoggedIn(ServerPlayer par1EntityPlayerMP, CallbackInfo callbackInfo) {
        par1EntityPlayerMP.sendChatToPlayer(ChatMessage.createFromTranslationKey("[MITE-Extreme]:").setColor(EnumChatFormat.WHITE)
                .appendComponent(ChatMessage.createFromTranslationKey("MITE-Extreme-" + Constant.MITE_ITE_VERSION + " 由 ")
                        .appendComponent(ChatMessage.createFromTranslationKey("LJX").setColor(EnumChatFormat.WHITE))));
        if (par1EntityPlayerMP.isFirstLogin == true) {
            par1EntityPlayerMP.isFirstLogin = false;
            par1EntityPlayerMP.inventory.addItemStackToInventory(new ItemStack(Block.torchWood, 1));
            par1EntityPlayerMP.sendPacket(new SPacketOverlayMessage("欢迎来到MITE世界！这是给你的火把。", EnumChatFormat.DARK_GREEN.rgb, 800));
        }
        this.updatePlayersFile();
    }

    @Shadow
    public void updatePlayersFile() {
    }
}
